param([string]$sourcePath=(Get-Location))
begin
{
		$fromDirectories = $sourcePath.split('\')
}
process
{
	[string]$relPath = $_.fullName
	if ($relPath -ne '')
	{
		$toDirectories = $relPath.split('\')
		
		$pathCnt = [math]::min($fromDirectories.Count,$toDirectories.Count)
		$commonRootIdx = -1
		for ($x=0; $x -lt $pathCnt; $x++) 
		{
			if ($fromDirectories[$x] -ne $toDirectories[$x])
			{
				break;
			}
			$commonRootIdx = $x
		}
		
		if ($commonRootIdx -gt -1)
		{		
			$relativeNodes = @()
			for ($x = $commonRootIdx + 1; $x -lt $fromDirectories.Count; $x++) {
				$relativeNodes += ".."
			}
			if ($relativeNodes.Count -eq 0)
			{
				$relativeNodes += "."
			}
			
			for ($x=$commonRootIdx + 1; $x -lt $toDirectories.Count; $x++) {
				$relativeNodes += $toDirectories[$x]
			}
			
			$result = New-Object "System.Text.StringBuilder"
			$delim = ''
			foreach($val in $relativeNodes)
			{
				[void]$result.Append($delim);
				[void]$result.Append($val);
				$delim = '\'
			}
			
			$relPath = $result.ToString()
		}
		
		Add-Member -inputObject ([PSObject]$_) note* -name RelativePath -value $relPath -passThru
	}	
}
